package com.avic.modules.equipment.service.mapper;

import com.avic.common.mapper.CoreMapper;
import com.avic.modules.equipment.domain.EquipmentOperation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhangzikang
 * @date 2022-08-14
 */
@Repository
@Mapper
public interface EquipmentOperationMapper extends CoreMapper<EquipmentOperation> {

    @Select("select d.* from (select *,Row_Number() OVER(partition by create_time order by running_state Asc) rar from equipment_operation )as d where d.equip_id = #{equipId}")
    List<EquipmentOperation> selectOperation(@Param("equipId")String equipId);

    @Delete("TRUNCATE TABLE equipment_operation")
    void del();
}
